#include<iostream>
#include<cstring>
using namespace std;
const int maxn =100;
int map[maxn][maxn],n,x,y;

int main(){
    cin>>n;
    map[1][(n+1)/2]=1;
    x=1;
    y=(n+1)/2;
    for(int i=2;i<=n*n;i++){
        if(x==1 && y!=n){//情况1 
            map[n][y+1]=i;
            x=n;
            y=y+1;
        }else if(x!=1 && y==n){//情况2 
            map[x-1][1]=i;
            x=x-1;
            y=1;
        }else if(x==1 && y==n){//情况3 
            map[x+1][y]=i;
            x=x+1;
        }else{//情况4 
            if(map[x-1][y+1]==0){
                map[x-1][y+1]=i;
                x=x-1;
                y=y+1;
            }else{
                map[x+1][y]=i;
                x=x+1;
            }
        }
    }
    
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            cout<<map[i][j]<<" ";
        }
        cout<<endl;
    }
}